//
//  ShowCollectionViewCell.m
//  NineGroupProject
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 lushan. All rights reserved.
//

#import "ShowCollectionViewCell.h"
#import "UIImageView+WebCache.h"
@implementation ShowCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatSubviews];
    }
    return self;
}
-(void)creatSubviews{
    self.showImageV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 350, 50)];
    [self.contentView addSubview:self.showImageV];
    
    
    
    self.label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
    [self.showImageV addSubview:self.label];
    
    
}

-(void)setNotes:(Notes *)notes{
    
    self.showImageV.frame = CGRectMake(0, 0, notes.width * 120 * HEI / notes.height, 120 * HEI);
    [self.showImageV sd_setImageWithURL:[NSURL URLWithString:notes.photo_url] placeholderImage:[UIImage imageNamed:@"loading.jpg"]];
    NSLog(@"%@",notes.imageDescription);
    if (![notes.imageDescription isEqualToString:@""]) {
        self.label.text = notes.imageDescription;
        self.label.frame = CGRectMake(0, 90, self.showImageV.frame.size.width, 30);
        
        self.label.backgroundColor = [UIColor colorWithWhite:0.247 alpha:0.5];
        self.label.textColor = [UIColor whiteColor];
    }else{
        self.label.frame = CGRectMake(0, 0, 0, 0);
    }
    
}

@end
